#include "StdAfx.h"
#include "LinkTextPanelUI.h"

CLinkTextPanelUI::CLinkTextPanelUI(void)
{
}

CLinkTextPanelUI::~CLinkTextPanelUI(void)
{
}

void CLinkTextPanelUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue)
{
	if( _tcscmp(pstrName, _T("align")) == 0 ) {
		if( _tcsstr(pstrValue, _T("center")) != NULL ) m_uTextStyle |= DT_CENTER;
		if( _tcsstr(pstrValue, _T("right")) != NULL ) m_uTextStyle |= DT_RIGHT;
	}
	else if( _tcscmp(pstrName, _T("width")) == 0 ) SetWidth(_ttoi(pstrValue));
	else if(_tcscmp(pstrName,_T("pos")) == 0)
	{
		RECT rcPos = {0};
		LPTSTR pstr = NULL;
		rcPos.left = _tcstol(pstrValue,&pstr,10);
		ASSERT(pstr);
		rcPos.top = _tcstol(pstr + 1,&pstr,10);
		ASSERT(pstr);
		rcPos.right = _tcstol(pstr + 1,&pstr,10);
		ASSERT(pstr);
		rcPos.bottom = _tcstol(pstr + 1,&pstr,10);
		ASSERT(pstr);
		SetPos(rcPos);
		m_rcPos = rcPos;
	}
	else CControlUI::SetAttribute(pstrName, pstrValue);
}

void CLinkTextPanelUI::DoPaint(HDC hDC, const RECT& rcPaint)
{
	//m_rcItem = m_rcPos;
	CTextPanelUI::DoPaint(hDC,rcPaint);
}
